<?php

/**
 * @file
 * Test suite for dbEventType module.
 * 
 * Copyright 2011 by UNHM CIS605 project Donate team.
 * This program is part of BBBS and YWCA Donation management system.
 * Donate is free software. It comes with absolutely no warranty.
 * You can redistribute it and/or modify it under the terms of the GNU
 * General Public License as published by the Free Software Foundation
 * (see <http://www.gnu.org/licenses/ for more information).
 * 
 * @version March 7, 2011
 * @author Laura Cassella
 */
/**
 * Include the php file that is being tested.
 * Test characteristics of EventType table.
 */
include_once(dirname(_FILE_) . '/../database/dbEventType.php');

class testdbEventType extends UnitTestCase {

    function testdbEventTypeModule() {
        // Add an eventType.
        $m = new EventType("6", "Donor Day", "Donors donate today.");
        $this->assertTrue(addEventType($m));

        //get an eventType.
        $i = geteventTypeID('6');
        $this->assertTrue($i !== null);

        // Add an eventName.
        $en = new EventType("8", "Fundraiser", "We raise funds.");
        $this->assertTrue(addEventType($en));

        // Add an eventDescription.
        $ed = new EventType("10", "Dinner", "Fundraising event");
        $this->assertTrue(addEventType($ed));

        // Try to add a duplicate - should return false.
        $et = new Event("6", "Donor Day", "Donors donate today.");
        $this->assertFalse(addEventType($et));

        //Try to get an eventType that is not in database.
        $this->assertFalse(getEventType("12"));

        // Get all eventTypes with a particular name.
        $en = getallEventName("Fundraiser");
        $this->assertTrue(count($en) == 1);

        // Remove all eventTypes
        $this->assertTrue(removeEventType("6"));
        $this->assertTrue(removeEventType("8"));
        $this->assertTrue(removeEventType("10"));

        // Try to remove an eventtype that is not in the database - should not work.
        $this->assertFalse(removeEventType("44"));

        echo("testdbEventType complete");
    }

}
?>
	